<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ApplicationProcesses extends Model
{
    use HasFactory;
    protected $table = 'application_processess';
    protected $fillable = ['project_id','user_id','level','role_id','type'];

    const POSTONLY = ['project_id','user_id','level','role_id','type'];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function user()
    {
        return $this->hasOne(User::class,'id','user_id')->select('id','name','mobile');
    }

    public function role()
    {
        return $this->hasOne(Role::class,'id','role_id')->select('id','name');
    }
}
